package com.ourteam.frame.service;

import net.dao.BaseQueryBean;
import net.dao.IDataAccessInterface;

public abstract class AbstractCRUDServiceHelper<Q extends BaseQueryBean, B, D extends IDataAccessInterface<B, Q>> {

	abstract protected D getDaoService();

	public B addNew(B object) throws Exception {

		getDaoService().insert(object);

		return object;

	}

	public B modify(B object) throws Exception {

		getDaoService().update(object);

		return object;

	}

	public B[] query(Q queryBean) throws Exception {

		return getDaoService().query(queryBean);

	}

	public int queryCount(Q queryBean) throws Exception {

		return getDaoService().queryCount(queryBean);

	}

	public void delete(Q queryBean) throws Exception {
		getDaoService().delete(queryBean);
	}

}
